loc <- filtered_dataset$location %>%
left_join(filtered_dataset$site_quali, by = "siteid") %>%
st_as_sf(coords = c("longitude", "latitude"),
crs = 4326)
fig_sites <- paste0(
"Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.")
world <- ne_countries(scale = "medium", returnclass = "sf")
bb <- st_bbox(loc)
ggplot(data = world) +
geom_sf() +
geom_sf(data = loc, aes(color = protocol), shape = 1) +
coord_sf(
xlim = bb[c("xmin", "xmax")],
ylim = bb[c("ymin", "ymax")],
expand = FALSE
) +
theme(legend.position = "bottom") +
labs(title = paste0("Number of sites: ", nrow(loc)))
Figure 2.1: Australia absence because span is superior to 10 years of 100s of sites but number of samplings < 10.
We used also hill numbers with coverage-based correction proposed by (???)
Betadiversity metrics compares the composition of two communities. In our case, we compare the composition of each time step relatively to the baseline, i.e. the first year of sampling.
Relative abundance: \(SER_a = \dfrac{\sum_i (p_i - p^{\prime}_i)^2}{\sum_i p_i^2 + \sum_i p^{\prime2}_i - \sum_i p_i p^{\prime}_i}\)
\(J\): Jaccard index
Turnover metrics based on presence/absence can be decomposed in appearance/disappearance and nestedness / turnover.
appearance: \(\dfrac{S_{imm}}{S_{tot}}\), disappearance: \(\dfrac{S_{lost}}{S_{tot}}\)
Nestedness: \(SER_r - J_t\)
ti <- map_dfr(rigal_trends, ~tabyl_df(x = .x, group = "direction"),
.id = "response"
)
ti %>%
filter(direction != "Total") %>%
select(response, direction, percent) %>%
mutate(response = str_replace_all(response, get_var_replacement())) %>%
pivot_wider(names_from = "direction", values_from = "percent") %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover"))
| response | stable | increase | decrease |
|---|---|---|---|
| Total abundance | 75.8% | 14.3% | 9.9% |
| Log Total Turnover (jaccard) (codyn) abundance | 73.3% | 16.5% | 10.2% |
| Species richness | 77.7% | 13.2% | 7.4% |
| Log species richness | 76.2% | 13.2% | 6.6% |
| Chao species richness | 79.8% | 10.6% | 8.2% |
| Chao Shannon | 76.5% | 12.1% | 7.7% |
| Chao Simpson | 78.4% | 10.5% | 7.4% |
| Chao Evenness | 82.8% | 7.5% | 5.9% |
| Jaccard (binary, similarity) | 76.8% | 2.8% | 17.5% |
| Horn (binary, similarity) | 77.3% | 2.7% | 17.2% |
| Chao (binary, similarity) | 71.5% | 2.3% | 8.3% |
| SER_a (rel abundance) | 75.3% | 4.1% | 18.6% |
| Total Turnover (jaccard) (codyn) | 73.7% | 18.3% | 3.0% |
| Appearance | 70.2% | 15.6% | 3.8% |
| disAppearance | 64.0% | 9.5% | 3.0% |
| Evenness | 78.8% | 9.4% | 8.1% |
| Shannon | 75.7% | 12.2% | 8.3% |
| Simpson | 77.9% | 10.8% | 7.7% |
| Jaccard (binary, dissimilarity) | 74.7% | 17.4% | 2.8% |
| Nestedness (jaccard) | 80.3% | 9.3% | 5.3% |
| Turnover (jaccard) | 57.4% | 8.3% | 1.7% |
ti <- map_dfr(rigal_trends, ~tabyl_df(x = .x, group = "shape_class"),
.id = "response"
)
ti %>%
filter(shape_class != "Total") %>%
select(response, shape_class, percent) %>%
mutate(response = str_replace_all(response, get_var_replacement())) %>%
pivot_wider(names_from = "shape_class", values_from = "percent") %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover"))
| response | stable_constant | increase_constant | decrease_constant | stable_convex | stable_concave | decrease_decelerated | increase_accelerated | increase_decelerated | decrease_accelerated | NA_constant |
|---|---|---|---|---|---|---|---|---|---|---|
| Total abundance | 62.1% | 13.7% | 8.7% | 7.8% | 5.9% | 1.2% | 0.5% | 0.1% | 0.0% | NA |
| Log Total Turnover (jaccard) (codyn) abundance | 57.8% | 14.4% | 9.5% | 6.6% | 8.9% | 0.3% | 0.3% | 1.8% | 0.4% | NA |
| Species richness | 63.7% | 11.9% | 6.8% | 5.2% | 8.8% | 0.4% | 0.5% | 0.8% | 0.2% | 1.7% |
| Log species richness | 62.9% | 11.8% | 6.1% | 3.8% | 9.5% | 0.3% | 0.3% | 1.0% | 0.2% | 4.0% |
| Chao species richness | 68.0% | 9.5% | 7.5% | 5.5% | 6.3% | 0.5% | 0.6% | 0.6% | 0.1% | 1.4% |
| Chao Shannon | 64.2% | 10.8% | 7.3% | 4.8% | 7.4% | 0.3% | 0.5% | 0.7% | 0.1% | 3.8% |
| Chao Simpson | 66.5% | 9.4% | 6.9% | 4.9% | 7.1% | 0.4% | 0.4% | 0.6% | NA | 3.8% |
| Chao Evenness | 73.3% | 7.1% | 5.6% | 4.1% | 5.4% | 0.1% | 0.1% | 0.3% | 0.1% | 3.8% |
| Jaccard (binary, similarity) | 64.4% | 2.7% | 16.3% | 7.1% | 5.3% | 0.7% | 0.0% | 0.1% | 0.5% | 2.9% |
| Horn (binary, similarity) | 65.2% | 2.5% | 15.9% | 6.4% | 5.7% | 0.5% | NA | 0.2% | 0.8% | 2.8% |
| Chao (binary, similarity) | 55.4% | 1.9% | 6.5% | 8.7% | 7.4% | 0.7% | NA | 0.4% | 1.0% | 17.9% |
| SER_a (rel abundance) | 60.6% | 3.8% | 16.7% | 7.9% | 6.8% | 1.1% | 0.0% | 0.3% | 0.8% | 2.0% |
| Total Turnover (jaccard) (codyn) | 63.7% | 17.2% | 2.8% | 4.8% | 5.3% | 0.1% | 0.7% | 0.4% | 0.0% | 4.9% |
| Appearance | 60.9% | 14.2% | 3.7% | 4.1% | 5.3% | 0.1% | 0.8% | 0.6% | NA | 10.3% |
| disAppearance | 54.7% | 8.9% | 2.7% | 5.4% | 4.0% | 0.3% | 0.4% | 0.2% | NA | 23.5% |
| Evenness | 67.4% | 8.6% | 7.7% | 5.4% | 6.0% | 0.3% | 0.2% | 0.6% | 0.1% | 3.7% |
| Shannon | 63.1% | 11.0% | 7.8% | 4.8% | 7.9% | 0.3% | 0.4% | 0.8% | 0.2% | 3.7% |
| Simpson | 65.4% | 9.5% | 7.2% | 4.7% | 7.7% | 0.2% | 0.4% | 0.9% | 0.3% | 3.7% |
| Jaccard (binary, dissimilarity) | 63.6% | 16.2% | 2.6% | 4.6% | 6.5% | 0.1% | 0.5% | 0.7% | 0.0% | 5.1% |
| Nestedness (jaccard) | 70.8% | 8.3% | 5.0% | 4.6% | 4.9% | 0.3% | 0.6% | 0.4% | 0.0% | 5.2% |
| Turnover (jaccard) | 50.5% | 8.0% | 1.6% | 3.5% | 3.4% | 0.1% | 0.2% | 0.1% | NA | 32.6% |
slope <- map_dfr(rigal_trends,
~.x %>%
select(siteid, linear_slope),
.id = "response"
)
rigal_trends_df <- map2_dfr(
rigal_trends, names(rigal_trends),
~.x %>% mutate(variable = .y)
) %>%
select(variable, siteid, linear_slope) %>%
pivot_wider(names_from = "variable", values_from = "linear_slope")
summary_slope <- slope %>%
group_by(response) %>%
summarise(summ = list(enframe(summary_distribution(linear_slope, na.rm = TRUE)))) %>%
unnest(cols = summ) %>%
pivot_wider(names_from = "name", values_from = "value") %>%
select(response, mean, median, sd)
summary_slope %>%
mutate(response = get_var_replacement()[response]) %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "bordered", "hover")) %>%
scroll_box(width = "100%", height = "1000px")
| response | mean | median | sd |
|---|---|---|---|
| Appearance | 0.0027393 | 0.0009691 | 0.0098864 |
| Chao (binary, similarity) | -0.0029650 | 0.0000000 | 0.0138050 |
| Chao evenness | 0.0000118 | 0.0000000 | 0.0687473 |
| Chao species richness | 0.0073944 | 0.0002926 | 0.1387268 |
| Chao shannon | 0.0043759 | 0.0007389 | 0.0822483 |
| Chao simpson | 0.0028965 | 0.0007189 | 0.0691378 |
| Disappearance | 0.0017718 | 0.0000000 | 0.0071868 |
| Evenness | 0.0006221 | 0.0000000 | 0.0144629 |
| SER_a (rel abundance) | -0.0072135 | -0.0032189 | 0.0183244 |
| Horn (binary, similarity) | -0.0041715 | -0.0027316 | 0.0113065 |
| Jaccard (binary, similarity) | -0.0051970 | -0.0037510 | 0.0135836 |
| Jaccard (binary, dissimilarity) | 0.0051970 | 0.0037510 | 0.0135836 |
| Log species richness | 0.2947554 | 0.0498002 | 2.6535099 |
| Log total abundance | 0.8272072 | 0.4993106 | 6.6756922 |
| Nestedness (jaccard) | 0.0021108 | 0.0002881 | 0.0137269 |
| Shannon | 0.0016449 | 0.0004650 | 0.0221596 |
| Simpson | 0.0007642 | 0.0001071 | 0.0111222 |
| Species richness | 0.0148247 | 0.0020269 | 0.1422215 |
| Total turnover (codyn) | 0.0045111 | 0.0032257 | 0.0115567 |
| Total abundance | 1.7786740 | 0.1129827 | 31.5332673 |
| Turnover (jaccard) | 0.0030863 | 0.0000000 | 0.0134089 |
p_jt_sup_ne <- sum(abs(rigal_trends_df$turnover) > abs(rigal_trends_df$nestedness)) /
nrow(rigal_trends_df)
rigal_trends_df %>%
ggplot(aes(x = jaccard , y = hillebrand)) +
geom_point() +
# geom_smooth(method = "gam") +
labs(x = "Jaccard trends (similarity, binary)", y = "Hillebrand trends
(similarity, relative abundance)")
rigal_trends_df_loc <- filtered_dataset$location %>%
left_join(rigal_trends_df, by = "siteid") %>%
st_as_sf(coords = c("longitude", "latitude"),
crs = 4326)
knitr::include_graphics(here("doc", "fig", "p_cor_slope_tot.png"))
ti <- expand.grid(
resp1 = unique(slope$response),
resp2 = unique(slope$response)
) %>%
filter(resp2 != resp1) %>%
filter(
resp1 %in% c("chao_richness", "species_nb", "log_species_nb",
"total_abundance", "log_total_abundance")) %>%
mutate_all(as.character) %>%
arrange(resp1)
test <- map2(ti$resp1, ti$resp2,
function(x, y) {
bi <- slope %>%
filter(response %in% c(x, y)) %>%
select(siteid, response, linear_slope) %>%
pivot_wider(names_from = "response", values_from = "linear_slope")
return(bi)
}
)
p_trends_trends <- map(test, function(x) {
l <- colnames(x)
x %>%
ggplot(aes(x = !!sym(l[2]), y = !!sym(l[3]))) +
geom_point() +
geom_smooth(method = "loess") +
labs(
x = get_var_replacement()[l[2]],
y = get_var_replacement()[l[3]]
)
})
names(p_trends_trends) <- map_chr(test, ~colnames(.x)[2])
plot_grid(
plotlist = p_trends_trends[names(p_trends_trends) %in% "log_species_nb"],
ncol = 3
)
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
#> `geom_smooth()` using formula 'y ~ x'
p <- map(c("log_species_nb", "log_total_abundance", "jaccard", "hillebrand", "appearance", "disappearance", "turnover", "nestedness"),
~ map_world_trends(
df = rigal_trends_df_loc, y = .x, range_per = .95) +
labs(title = get_var_replacement()[.x])
)
p
#> [[1]]
#>
#> [[2]]
#>
#> [[3]]
#>
#> [[4]]
#>
#> [[5]]
#>
#> [[6]]
#>
#> [[7]]
#>
#> [[8]]
basin_slope <- rigal_trends_df_loc %>%
group_by(main_bas) %>%
summarise(across(where(is.double), median))
p_basin <- map(c("log_species_nb", "log_total_abundance", "jaccard", "hillebrand", "appearance", "disappearance", "turnover", "nestedness"),
~ map_world_trends(
df = basin_slope, y = .x, range_per = .95) +
labs(title = get_var_replacement()[.x])
)
p_basin
#> [[1]]
#>
#> [[2]]
#>
#> [[3]]
#>
#> [[4]]
#>
#> [[5]]
#>
#> [[6]]
#>
#> [[7]]
#>
#> [[8]]
country_slope <- rigal_trends_df_loc %>%
group_by(country) %>%
summarise(across(where(is.double), median))
p_country <- map(c("log_species_nb", "log_total_abundance", "jaccard", "hillebrand", "appearance", "disappearance", "turnover", "nestedness"),
~ map_world_trends(
df = country_slope, y = .x, range_per = .95) +
labs(title = get_var_replacement()[.x])
)
p_country
#> [[1]]
#>
#> [[2]]
#>
#> [[3]]
#>
#> [[4]]
#>
#> [[5]]
#>
#> [[6]]
#>
#> [[7]]
#>
#> [[8]]
b_country <- map(c("log_species_nb", "log_total_abundance", "jaccard", "hillebrand", "appearance", "disappearance", "turnover", "nestedness"),
~ rigal_trends_df_loc %>%
ggplot(aes(x = country, y = !!sym(.x), fill = ecoregion)) +
geom_boxplot() +
labs(title = get_var_replacement()[.x])
)
b_country
#> [[1]]
#>
#> [[2]]
#>
#> [[3]]
#>
#> [[4]]
#>
#> [[5]]
#>
#> [[6]]
#>
#> [[7]]
#>
#> [[8]]
Cf other document
Reproducibility receipt
## datetime
Sys.time()
#> [1] "2022-01-20 10:49:39 CST"
## repository
if(requireNamespace('git2r', quietly = TRUE)) {
git2r::repository()
} else {
c(
system2("git", args = c("log", "--name-status", "-1"), stdout = TRUE),
system2("git", args = c("remote", "-v"), stdout = TRUE)
)
}
#> Local: main /home/alain/Documents/post-these/isu/RivFishTimeBiodiversityFacets
#> Head: [3695d10] 2022-01-20: fix hillebrand: change entry matrix
## session info
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 10 (buster)
#>
#> Matrix products: default
#> BLAS: /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRblas.so
#> LAPACK: /home/alain/.Renv/versions/4.0.5/lib/R/lib/libRlapack.so
#>
#> locale:
#> [1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
#> [5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
#> [7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] future_1.21.0 vegan_2.5-7
#> [3] lattice_0.20-41 permute_0.9-5
#> [5] codyn_2.0.5 janitor_2.1.0
#> [7] viridis_0.5.1 viridisLite_0.3.0
#> [9] cowplot_1.1.1 rnaturalearthdata_0.1.0
#> [11] rnaturalearth_0.1.0 sf_1.0-4
#> [13] rmarkdown_2.11 scales_1.1.1
#> [15] kableExtra_1.3.1 here_1.0.1
#> [17] lubridate_1.7.9.2 magrittr_2.0.1
#> [19] forcats_0.5.1 stringr_1.4.0
#> [21] dplyr_1.0.4 purrr_0.3.4
#> [23] readr_2.1.1 tidyr_1.1.2
#> [25] tibble_3.1.6 ggplot2_3.3.3
#> [27] tidyverse_1.3.0 tarchetypes_0.3.2
#> [29] targets_0.8.1 conflicted_1.1.0
#> [31] nvimcom_0.9-123
#>
#> loaded via a namespace (and not attached):
#> [1] colorspace_2.0-0 ellipsis_0.3.2 class_7.3-18
#> [4] rprojroot_2.0.2 snakecase_0.11.0 fs_1.5.1
#> [7] rstudioapi_0.13 farver_2.0.3 listenv_0.8.0
#> [10] fansi_0.5.0 xml2_1.3.2 codetools_0.2-18
#> [13] splines_4.0.5 cachem_1.0.4 knitr_1.36
#> [16] jsonlite_1.7.2 broom_0.7.4 cluster_2.1.1
#> [19] dbplyr_2.1.0 rgeos_0.5-5 compiler_4.0.5
#> [22] httr_1.4.2 backports_1.2.1 assertthat_0.2.1
#> [25] Matrix_1.3-2 fastmap_1.1.0 cli_3.1.0
#> [28] s2_1.0.7 htmltools_0.5.1.1 tools_4.0.5
#> [31] igraph_1.2.6 gtable_0.3.0 glue_1.5.1
#> [34] wk_0.5.0 Rcpp_1.0.6 jquerylib_0.1.3
#> [37] cellranger_1.1.0 vctrs_0.3.8 nlme_3.1-152
#> [40] xfun_0.28 globals_0.14.0 ps_1.6.0
#> [43] rvest_0.3.6 lifecycle_1.0.1 MASS_7.3-53.1
#> [46] hms_1.1.1 parallel_4.0.5 RColorBrewer_1.1-2
#> [49] yaml_2.2.1 memoise_2.0.0 gridExtra_2.3
#> [52] sass_0.3.1 stringi_1.7.6 highr_0.9
#> [55] e1071_1.7-4 rlang_0.4.12 pkgconfig_2.0.3
#> [58] evaluate_0.14 labeling_0.4.2 processx_3.5.2
#> [61] tidyselect_1.1.1 parallelly_1.23.0 bookdown_0.24
#> [64] R6_2.5.1 generics_0.1.0 DBI_1.1.1
#> [67] pillar_1.6.4 haven_2.3.1 withr_2.4.3
#> [70] mgcv_1.8-34 units_0.6-7 sp_1.4-5
#> [73] modelr_0.1.8 crayon_1.4.2 KernSmooth_2.23-18
#> [76] utf8_1.2.2 tzdb_0.2.0 grid_4.0.5
#> [79] readxl_1.3.1 data.table_1.13.6 git2r_0.29.0
#> [82] callr_3.7.0 reprex_1.0.0 digest_0.6.27
#> [85] classInt_0.4-3 webshot_0.5.2 munsell_0.5.0
#> [88] bslib_0.2.4
Barnagaud, Jean-Yves, Pierre Gaüzère, Benjamin Zuckerberg, Karine Princé, and Jens-Christian Svenning. 2017. “Temporal Changes in Bird Functional Diversity Across the United States.” Oecologia 185 (4): 737–48. https://doi.org/10.1007/s00442-017-3967-4.
Blowes, Shane A., Sarah R. Supp, Laura H. Antão, Amanda Bates, Helge Bruelheide, Jonathan M. Chase, Faye Moyes, et al. 2019. “The Geography of Biodiversity Change in Marine and Terrestrial Assemblages.” Science 366 (6463): 339–45. https://doi.org/10.1126/science.aaw1620.
Dornelas, Maria, Nicholas J. Gotelli, Brian McGill, Hideyasu Shimadzu, Faye Moyes, Caya Sievers, and Anne E. Magurran. 2014. “Assemblage Time Series Reveal Biodiversity Change but Not Systematic Loss.” Science 344 (6181): 296–99. https://doi.org/10.1126/science.1248484.
Hillebrand, Helmut, Bernd Blasius, Elizabeth T. Borer, Jonathan M. Chase, John A. Downing, Britas Klemens Eriksson, Christopher T. Filstrup, et al. 2018. “Biodiversity Change Is Uncoupled from Species Richness Trends: Consequences for Conservation and Monitoring.” Journal of Applied Ecology 55 (1): 169–84. https://doi.org/https://doi.org/10.1111/1365-2664.12959.
Klink, Roel van, Diana E. Bowler, Konstantin B. Gongalsky, Ann B. Swengel, Alessandro Gentile, and Jonathan M. Chase. 2020. “Meta-Analysis Reveals Declines in Terrestrial but Increases in Freshwater Insect Abundances.” Science 368 (6489): 417–20. https://doi.org/10.1126/science.aax9931.
Mouchet, Maud A., Sébastien Villéger, Norman W. H. Mason, and David Mouillot. 2010. “Functional Diversity Measures: An Overview of Their Redundancy and Their Ability to Discriminate Community Assembly Rules.” Functional Ecology 24 (4): 867–76. https://doi.org/10.1111/j.1365-2435.2010.01695.x.
Soininen, Janne, Sophia Passy, and Helmut Hillebrand. 2012. “The Relationship Between Species Richness and Evenness: A Meta-Analysis of Studies Across Aquatic Ecosystems.” Oecologia 169 (3): 803–9. https://doi.org/10.1007/s00442-011-2236-1.
Vellend, Mark, Lander Baeten, Isla H. Myers-Smith, Sarah C. Elmendorf, Robin Beauséjour, Carissa D. Brown, Pieter De Frenne, Kris Verheyen, and Sonja Wipf. 2013. “Global Meta-Analysis Reveals No Net Change in Local-Scale Plant Biodiversity over Time.” Proceedings of the National Academy of Sciences 110 (48): 19456–9.